<?php
/**
 * File: DeleteProject.class.php
 * Author: camy <375766145@qq.com>
 * Time: 2018/3/22 14:58
 */


namespace Common\Extend\DingTalk\Message\Project;

use Common\Extend\DingTalk\Message\BaseMessage;

class DeleteProject extends BaseMessage
{
    public function send($param)
    {
        //标题
        $this->title = '项目提醒';
        //发送人
        $userId = M('projectMember')
            ->where(['project_id' => $param['project_id'], 'user_type' => 2])
            ->getField('user_id');
        $people = $this->getUserId($userId);
        //发送内容
        $projectName = M('project')
            ->where(['id' => $param['project_id']])
            ->getField('name');
        $text = "项目【{$projectName}】已被管理员删除";
        $message = $this->getMessage($text);
        //发送消息
        dingtalk()->sendMessage($people, $message);

    }
}